home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / menus / mxmnu241.zip / NOVELL.INC < prev    next >
Text File  |  1993-01-23  |  6KB  |  271 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file exports definitions that create a Novell menu look and
  5. feel. This is one of several look and feel files that export the same
  6. procedures.
  7.  
  8. Useful Routines Exported:
  9.  
  10. LookSetup
  11.    Call this to initialize the screen. Set MenuTitle and StatusLineText
  12.    before calling this routine.
  13.  
  14. CornerStretchBox (Header,Col,Row)
  15.    Creates a window from the array Choices with the upper left corner at
  16.    Row/Col. LastKey is set to the letter that is chosen.
  17.  
  18. CenterStretchBox (Header,Col,Row)
  19.    Creates a window from the array Choices with the center at Row/Col.
  20.    if a 0 is passed for either the Row or Col then the center of the
  21.    screen is assumed. LastKey is set to the letter that is chosen.
  22.  
  23. Leave
  24.    Puts up an exit box.
  25.  
  26.  
  27. ==========================================================
  28. EndComment
  29.  
  30.  
  31. var
  32.   Choices
  33.   MenuTitle
  34.   StatusLineText
  35.   StatusWindow
  36.   HeightDifference
  37.   Greek = False
  38.  
  39. var
  40.   BackGroundFG
  41.   BackGroundBG
  42.   TitleBoxBorderFG
  43.   TitleBoxBG
  44.   TitleBoxInsideFG
  45.   ClockColorFG
  46.   StatusLineFG
  47.   StatusLineBG
  48.   MenuInsideFG
  49.   MenuBG
  50.   MenuHeaderFG
  51.   MenuBorderFG
  52.   MenuVertLinesFG
  53.   MenuInverseFG
  54.   MenuInverseBG
  55.   MenuCapColorFG
  56.   ConsoleInsideFG
  57.   GreekFG
  58.   GreekBG
  59.  
  60. ;------ This is where you set your favorite colors.
  61.  
  62. Procedure SetColors
  63.    if ColorScreen
  64.       BackGroundFG     = Grey
  65.       BackGroundBG     = Blue
  66.       TitleBoxBG       = Brown
  67.       TitleBoxBorderFG = White
  68.       TitleBoxInsideFG = Yellow
  69.       ClockColorFG     = Yellow
  70.       StatusLineFG     = Yellow
  71.       StatusLineBG     = Mag
  72.       MenuBG           = Blue
  73.       MenuInsideFG     = Yellow
  74.       MenuBorderFG     = Yellow
  75.       MenuHeaderFG     = LCyan
  76.       MenuVertLinesFG  = LGreen
  77.       MenuInverseFG    = White
  78.       MenuInverseBG    = Mag
  79.       MenuCapColorFG   = White
  80.       ConsoleInsideFG  = White
  81.       GreekFG          = Blue
  82.       GreekBG          = Green
  83.       BoxHeaderColor Yellow Green
  84.    else
  85.       BackGroundFG     = Grey
  86.       BackGroundBG     = Black
  87.       TitleBoxBG       = Grey
  88.       TitleBoxBorderFG = Black
  89.       TitleBoxInsideFG = Black
  90.       ClockColorFG     = Black
  91.       StatusLineFG     = Black
  92.       StatusLineBG     = Grey
  93.       MenuBG           = Black
  94.       MenuInsideFG     = Grey
  95.       MenuBorderFG     = Grey
  96.       MenuHeaderFG     = White
  97.       MenuVertLinesFG  = White
  98.       MenuInverseFG    = Black
  99.       MenuInverseBG    = Grey
  100.       MenuCapColorFG   = White
  101.       ConsoleInsideFG  = Grey
  102.       GreekFG          = Black
  103.       GreekBG          = Grey
  104.       BoxHeaderColor Black Grey
  105.    endif
  106. EndProc
  107.  
  108. ;------ Sets up main window to Novell look.
  109.  
  110. Procedure LookSetup
  111.    if MenuInsideFG = 0 then SetColors
  112.    NoExit
  113.  
  114.    ;------ Clear the screen with a textured background
  115.  
  116.    TextColor BackGroundFG BackGroundBG
  117.    ClearScreen 176
  118.  
  119.    ;------ If Greek is true then draw greek columns
  120.  
  121.    if Greek then GreekColumns
  122.  
  123.    ;------ Draw Status Line
  124.  
  125.    NoBoxBorder
  126.    Explode Off
  127.    BoxInsideColor StatusLineFG StatusLineBG
  128.    DrawBox 1 ScreenHeight ScreenWidth 1
  129.    StatusWindow = CurrentWindow
  130.    WriteCenter(StatusLineText)
  131.  
  132.    ;------ Draw the Title Box
  133.  
  134.    SingleLineBox
  135.    BoxInsideColor TitleBoxInsideFG TitleBoxBG
  136.    BoxBorderColor TitleBoxBorderFG TitleBoxBG
  137.    DrawBox 1 1 ScreenWidth 3
  138.    GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)
  139.    Write MenuTitle
  140.  
  141.    ;------ Display the clock
  142.  
  143.    ClockColor ClockColorFG TitleBoxBG
  144.    ClockPos 3 2
  145.  
  146.    ;------ Setup Console
  147.  
  148.    ConsolePos 42 5
  149.    ConsoleHeaderColor MenuInverseFG MenuInverseBG
  150.    ConsoleInsideColor ConsoleInsideFG MenuBG
  151.  
  152.    HeightDifference = 4
  153. EndProc
  154.  
  155.  
  156. Procedure MakeBox(Header,Col,Row,Center)
  157. var NumElem Height Width Cnt
  158.  
  159.    Width = Length(Header) - 1
  160.    NumElem = NumberOfElements(Choices)
  161.  
  162.      ;Get the widest element in the Choices Array
  163.  
  164.    if Length(Choices[1]) > 0
  165.       Cnt = 65
  166.       loop NumElem
  167.          Trim(Choices[LoopIndex])
  168.          if left(Choices[LoopIndex],1) <> '─'
  169.             Choices[LoopIndex] = " " + Char(Cnt) + ". " + Choices[LoopIndex]
  170.             Cnt = Cnt + 1
  171.          endif
  172.          Width = Max(Width,Length(Choices[LoopIndex]))
  173.       endloop
  174.    else
  175.       Width = ScreenWidth - 7
  176.    endif
  177.    Height = NumElem + 2
  178.    if Header > '' then Height = NumElem + 4
  179.    Width = Width + 5
  180.    if Center
  181.       if Row = 0
  182.  
  183.          ;Center window verticaly
  184.  
  185.          Row = ((ScreenHeight - Height) / 2) + 2
  186.       else
  187.  
  188.          ;Center window with X Coordinate
  189.  
  190.          Row = (Row - (Height / 2) + 1)
  191.       endif
  192.       if Col = 0
  193.  
  194.          ;Center window horizonitly
  195.  
  196.          Col = (ScreenWidth - Width) / 2 + 1
  197.       else
  198.  
  199.          ;Center window with Y Coordinate
  200.  
  201.          Col = (Col - (Width / 2) + 1)
  202.       endif
  203.    endif
  204.  
  205.    ;Make Sure Row and Col are within their range
  206.  
  207.    Row = Max(Row,5)
  208.    Row = Min(Row,ScreenHeight - Height - 1)
  209.    Col = Max(Col,2)
  210.    Col = Min(Col,ScreenWidth - Width)
  211.  
  212.    DrawTheBox(Col,Row,Width,Height,Header)
  213.  
  214.      ;Write the menu choices
  215.  
  216.    loop(NumElem - 1)
  217.       if left(Choices[LoopIndex],1) = '─'
  218.          TextColor MenuVertLinesFG MenuBG
  219.          ClearLine 196
  220.          TextColor MenuInsideFG MenuBG
  221.          CapsColor(MenuCapColorFG,MenuBG)
  222.          Writeln
  223.       else
  224.          Writeln(Choices[LoopIndex])
  225.       endif
  226.    endloop
  227.  
  228.    Write Choices[NumElem]
  229.    UseArrows On
  230.    Dispose(Choices)
  231. EndProc
  232.  
  233. ;------ Draw the Box
  234.  
  235. Procedure DrawTheBox (Col,Row,Width,Height,Header)
  236.  
  237.      ;Draw the main window
  238.  
  239.    DoubleLineBox
  240.    InactiveBox SingleLineBox
  241.    BoxInsideColor(MenuInsideFG,MenuBG)
  242.    BoxBorderColor(MenuBorderFG,MenuBG)
  243.    DrawBox(Col, Row, Width, Height)
  244.  
  245.    if Header > ''
  246.  
  247.      ;Write the header
  248.  
  249.       TextColor(MenuHeaderFG,MenuBG)
  250.       WriteCenter(Header)
  251.  
  252.      ;Write the vertical lines
  253.  
  254.       TextColor(MenuVertLinesFG,MenuBG)
  255.       Writeln
  256.       ClearLine 196
  257.       GotoXY 2 2
  258.       WriteVertical mid(VertLine,1,Height - 3)
  259.  
  260.      ;Draw the menu text box
  261.  
  262.       CapsColor(MenuCapColorFG,MenuBG)
  263.       InverseColor(MenuInverseFG,MenuInverseBG)
  264.       Window(Col + 3, Row + 3, Width - 4, Height - 4)
  265.    else
  266.       CapsColor Black Black
  267.    endif
  268. EndProc
  269.  
  270.  
  271.